package behavioral_pattern.strategy_pattern;

/**
 * 电影票类：环境类
 */
public class MovieTicket {
    private double price;

    private Discount discount;

    public void setPrice(double price){
        this.price = price;
    }
    //注入一个折扣类对象
    public void setDiscount(Discount discount){
        this.discount = discount;
    }
    public double getPrice(){
        return discount.calculate(price);
    }

}

